<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="button" onclick="openWindow()" value="打开一个新的窗口">
    <script>
      /*console.dir(window);
      console.log(window.location);
      window.alert(); //window可以省略不写
      window.onload = function () {}; //window可以省略不写
      window.str = "abc"; //JS中全局对象是window Node.js的全局对象是global */

      /* 常用属性：
    document history location navigator	screen name opener screenX	screenY	status(状态栏) */
      console.log(document);
      document.body.style.background = "#eee";

      console.log(history);

      console.log(navigator);

      window.name = "这是新创建的窗口";
      console.log(name);

      function openWindow(){
        newWindow = window.open("","","width=200,height=200");
        newWindow.document.write("<h2>这是我创建的窗口</h2>");
        newWindow.focus();
        
        newWindow.opener.document.write("<p>这是之前的窗口<p>");//引用创建的这个新窗口的窗口
      }

      console.log(screen);
      console.log(screenX);
      console.log(screenY);
      status = new Date();
      console.log(status);
    </script>
  </body>
</html>
